const state = () => ({
    ynMap: {
        'Y': '是',
        'N': '否'
    },
    cacheComponent: [],
    isSelectionInterface:true,
    PassageWays:{
        DT:[],
        NY:[],
        YJ:[],
        CG:[]
    }
})

const getters = {}

const actions = {
    changeSelectionInterface({commit}, changeName){
        commit('changeSelectionInterface', changeName)
    },
    addCacheComponent({commit}, cacheName){
        commit('addCacheComponent', cacheName)
    },
    removeCacheComponent({commit}, cacheName){
        commit('removeCacheComponent', cacheName)
    },
    changePassageWays({commit}, cacheName){
        commit('changePassageWays', cacheName)
    },
}

const mutations = {
    changeSelectionInterface(state,cacheName){
        state.isSelectionInterface = cacheName
    },
    changePassageWays(state,PassageWays){
        state.PassageWays = PassageWays
    },
    addCacheComponent(state, cacheName){
        if(state.cacheComponent.indexOf(cacheName) == -1){
            state.cacheComponent.push(cacheName)
        }
    },
    removeCacheComponent(state, cacheName){
        const index = state.cacheComponent.indexOf(cacheName)
        if(index != -1){
            state.cacheComponent.splice(index, 1)
        }
    }
}

export default {
    state,
    getters,
    actions,
    mutations
}
